package com.filldream.fastboot.common.util;

import com.filldream.fastboot.common.entity.BasePage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;

import java.util.Optional;

/**
 * @author RickSun
 * @version 1.0
 * @data 2021-05-13 18:01
 * @description 基础工具类
 */
@Slf4j
public class BaseUtil {

    /**
     * @author RickSun
     * @Description 两值是否相等，左值可以位空
     * @remark left == null || left.equal(right)
     **/
    public static boolean equalsOrNull(Object left,Object right){
        if (left == null) {
            return true;
        } else if (left instanceof Optional) {
            return !((Optional)left).isPresent();
        }
        return left.equals(right);
    }

}
